//
//  BMTabView.h


#import <UIKit/UIKit.h>
#import "CommonData.h"

@protocol DWTabViewDelegate <NSObject>

@optional;
-(void)doneRelayoutItemViews;

@end

/**
 *  选择回调
 *
 *  @param index    当前选中的index
 *  @param oldIndex 上次选中的index
 */
typedef void(^BMTabViewSelection)(NSUInteger index, NSUInteger oldIndex);


/**
 *  选中指示条位置，顶部，和底部
 */
typedef NS_ENUM(NSInteger, BMTabViewIndicatorPoistion){
    BMTabViewIndicatorPoistionTop,
    BMTabViewIndicatorPoistionBottom
};


/**
 *  Tab选择视图， 根据传入items自适应宽度
 *  
 */
@interface DWTabView : UIView


@property (nonatomic, weak)id <DWTabViewDelegate> delegate;

@property (nonatomic, strong) IBInspectable NSMutableArray* itemsButton;

/**
 *  tabItems，每个item为string
 */
@property (nonatomic, strong) IBInspectable NSArray* items;

/**
 *  tabItem 之间的间距，默认为20px
 */
@property (nonatomic, assign) IBInspectable CGFloat itemSpacing;

/**
 *  item宽度
 */
@property (nonatomic, readonly) CGFloat itemWith;

/**
 *  左右tabItems的头部间距和尾部间距,默认为30px
 */
@property (nonatomic, assign) IBInspectable CGFloat padding;

/**
 *  tabItem 未选中时的颜色
 */
@property (nonatomic, strong) IBInspectable UIColor* normalColor;

/**
 *  tabItem 选中时的颜色
 */
@property (nonatomic, strong) IBInspectable UIColor* selectColor;

/**
 *  item字体，默认为16
 */
@property (nonatomic, strong) IBInspectable UIFont* itemFont;

/**
 *  item字体，默认为18
 */
@property (nonatomic, strong) IBInspectable UIFont* selectItemFont;

/**
 *  是否靠边展示
 */
@property (nonatomic, assign)BOOL isPullOver;
//靠边倍数 默认1.5 
@property (nonatomic, assign)CGFloat multiple;

/**
 *  是否隐藏指示,默认为NO
 */
@property (nonatomic, assign) IBInspectable BOOL hideIndicators;


/**
 *  指示条位置，默认为BMTabViewIndicatorPoistionTop
 */
#if TARGET_INTERFACE_BUILDER
@property (nonatomic, assign) IBInspectable NSInteger indicatorPosition;
#else
@property (nonatomic, assign) BMTabViewIndicatorPoistion indicatorPosition;
#endif

/**
 *  选中回调
 */
@property (nonatomic, strong) BMTabViewSelection selection;


/**
 *  当前选中的tab index
 */
@property (nonatomic, assign) NSUInteger selectedIndex;

/**
 *  切换选中的tab index
 *
 *  @param selectedIndex  index
 *  @param selectionBlock 选中回调
 */
- (void)setSelectedIndex:(NSUInteger)selectedIndex
          selectionBlock:(BMTabViewSelection)selectionBlock;

- (void)scrollIndicatorBetweenIndex1:(NSUInteger)index1 index2:(NSUInteger)index2 withPercent:(CGFloat)percent;

////设置消息红点
-(void)setRedDot:(NSInteger )index show:(BOOL )isshow;

@end
